<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>编辑用户</title>
</head>
<body>
<h1>编辑用户</h1>

<form action="/userUpdate" method="post">
    <input type="hidden" name="id" th:value="${user.id}">  <!-- 隐藏域 -->
    <p>姓名：<input type="text" name="name" th:value="${user.name}"></p>
    <p>年龄：<input type="text" name="age" th:value="${user.age}"></p>
    <p>手机号：<input type="text" name="phone" th:value="${user.phone}"></p>
    <p>部门：
        <select name="deptCode" id="">
            <option th:each="d:${deptList}"
                    th:value="${d.deptCode}"
                    th:text="${d.deptName}"
                    th:selected="${d.deptCode == user.deptCode}">财务部</option>
        </select>
    </p>
    <p><button type="submit">提交</button></p>
</form>
<p th:text="${msg}"></p>
</body>
</html>